<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script src="../lib/promise.js"></script>
<script>
    const promise = new Promise((resolve, reject) => {
        setTimeout(() => {
            // resolve(1);
            // console.log('resolve之后');
            reject(2);
            // reject(3);
            console.log('reject之后');
        }, 1000);

        throw 4;
    });

    promise.then((value) => {
        console.log('onResolved()', value);
    }, (reason) => {
        console.log('onRejected()', reason);
    });

    promise.then((value) => {
        console.log('onResolved2()', value);
    }, (reason) => {
        console.log('onRejected2()', reason);
    });
</script>
</body>
</html>
